package com.db.gffxo.epi.test;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import junit.framework.TestCase;
import com.db.gffxo.epi.domain.EventPublish;
import com.db.gffxo.epi.repository.EventPublishDaoGen;


public class EventPublishTestGen extends TestCase {

private DriverManagerDataSource dataSource;
private EventPublishDaoGen dao;
private EventPublish EventPublish;
	public void setUp() {
		dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
		dataSource.setUrl("jdbc:mysql:///epi");
		dataSource.setUsername("epi");
		dataSource.setPassword("epiepi");
		dao= new EventPublishDaoGen();
		dao.setDataSource(dataSource);

		EventPublish = new EventPublish();
		EventPublish.setEventType("EventType");
		EventPublish.setPublisherName("PublisherName");
		EventPublish.setPublisherParams("PublisherParams");
	}

	public void testInsertAndGet () {

		dao.insert(EventPublish);

		List dbaEventPublishs = dao.getEventPublish();

		EventPublish dbaEventPublish = (EventPublish) dbaEventPublishs.get(0);

		assertEquals("EventType",EventPublish.getEventType(),dbaEventPublish.getEventType());
		assertEquals("PublisherName",EventPublish.getPublisherName(),dbaEventPublish.getPublisherName());
		assertEquals("PublisherParams",EventPublish.getPublisherParams(),dbaEventPublish.getPublisherParams());
	}

}